package com.itheima.Demo01.demo03;

import java.lang.reflect.Constructor;

public class NewInstance {
    public static void main(String[] args) throws Exception {
        Class aClass = Class.forName("com.itheima.Demo01.demo03.Student");

        Object o = aClass.newInstance();
        System.out.println(o);

        Constructor c1 = aClass.getConstructor(String.class,int.class);
        Object o1 = c1.newInstance("zhangsan",18);
        System.out.println(o1);

        Constructor c2 = aClass.getConstructor();
        Object o2 = c2.newInstance();
        System.out.println(o2);
    }
}
